The present invention relates to a method of storing and retrieving data from handheld devices, and in particular to a method of storing and retrieving data from handheld devices by key word.
There are various kinds of handheld devices, from low-end electronic notebooks and cellular phones to high-end palm and handheld computers. PalmPilot by 3COM, as an example of a handheld device, has more than 63% of the worldwide market share of handheld devices. Today, there are more than 10,000 developers on the PalmPilot platform and over 2000 third party manufacturers developing various applications including communications, games, etc.
Although there are many kinds of handheld devices, they have one thing in common, they are small to keep them lightweight. So, the hardware resources for handheld devices are very limited.
Compared with a desktop system, handheld devices have no large capacity storage, such as a magnetic disc. Additionally, there is usually only an internal memory module which is usually less than one megabyte (MB). Although the memory can be expanded using a PCMCIA card, it usually will still only be several more MB, not nearly comparable with magnetic and optical discs, which are widely used in desktop systems.
Due to a requirement for low power consumption, the computing speed of handheld devices is also very limited, and is not nearly comparable with the speed of desktop systems.
Because of the limited memory space on handheld devices, how to store data to save more memory is always a problem worth discussion. Also, because of the limited computing speed on handheld devices, how to rapidly search data stored in them is another problem worth discussion.
The operating system used on handheld devices has to be considered to solve the above problems. There are various operating systems for resource limited handheld devices. Some of them are Palm OS by 3COM, Windows CE by Microsoft, Newton Intelligence by Apple, GEOS by Geoworks, Magic Cap by Magic, PenPoint by Co, etc. The present invention uses Palm OS based handheld devices as an example to discuss and solve the above problems.
WorkPad by IBM and PalmPilot by 3COM are typical products based on Palm OS. Currently, WorkPad has only 1 to 2 MB of memory and the computing speed is limited by its 16 MHZ Motorola 68000 series processor.
In WorkPad, the memory space is divided into ROM and RAM, which are on the same memory module. The capacity of ROM is 0.5 to 1.5 MB. The capacity of RAM is 1 MB minimum. Palm OS main applications are preloaded into ROM. Other applications or substitute applications and system extensions can be loaded into RAM. However, this is not always possible due to the limitation of the RAM capacity. Applications can be upgraded by replacing the ROM. Whole system and applications can be upgraded by installing a new memory module.
Palm OS is designed as a 32 bit system, the address is 32 bits, supports 4 GB address space to store code and data, and works efficiently with little RAM. Palm OS divides the RAM into two virtual parts, dynamic RAM and storage RAM. Dynamic RAM is 32 KB, used as the working space of Palm OS for stack, global variable, and temporary memory. Dynamic RAM is similar to the internal RAM in a desktop system. The other RAM is storage RAM, used to store user data such as is found in Appointments, Todo Lists, MemoPad, and an Address Book. The user data can be WorkPad applications developed by third party developers. The storage RAM is similar to disc storage in a normal desktop system. The memory is powered all the time, even when the handheld device is xe2x80x9cturned offxe2x80x9d (in low power sleeping mode), and the data in the two RAM areas is preserved. All the memory is protected when the handheld device is reset, but the dynamic RAM may be re-initialized as a part of a booting procedure.
Because the Palm OS device has a limited amount of dynamic memory available and uses nonvolatile RAM instead of disk storage, a traditional file system is not optimal for storing and retrieving user data such as meetings or address book entries.
Traditional file systems work by first reading all or a portion of a file into a memory buffer from disk, using or updating the information in the memory buffer, and then writing the updated information back to disk. Because of the high latency involved in reading or writing to disk, it is not practical to use small memory buffers, and, typically, many kilobytes of data are read from or written to disk at a time.
On the Palm OS device, it makes more sense to access and update data directly in place, because all nonvolatile information on the Palm OS device is stored in memory. This eliminates the extra overhead involved in a file system of transferring the data to and from another memory buffer and also reduces the dynamic memory requirements.
Current database techniques cannot be used on Palm OS based handheld devices without using the file system. For example, in current database techniques, an index file is set up for a keyword and the database is searched using the keyword as an index. But on Palm OS based handheld devices, the records have to be compared with a keyword one by one using a pre-written program. Writing such a program is not only complicated and time consuming, but the searching speed is also very slow due to the large amount of string comparison computing that is necessary.
The problem solved by the present invention is how to efficiently store and rapidly search data in the limited storage space of Palm OS based handheld devices.
The first object of the present invention is to provide a method of storing data in a Palm OS based handheld device.
The second object of the present invention is to provide a method of retrieving data by keyword from a Palm OS based handheld device.
The third object of the present invention is to provide an apparatus for storing data in a Palm OS based handheld device.
The forth object of the present invention is to provide an apparatus for retrieving data by keyword from a Palm OS based handheld devices.
In order to achieve the first object, the present invention provides a method of storing data into a Palm OS based handheld device, the data including at least one record, each one of the records containing a keyword used for identifying the record, the method characterized by the step of:
storing each record as a resource into a resource database in the handheld device, wherein the keyword contained in each record is converted into a long integer, then divided into two parts, and the two parts are stored respectively as a resource type and a resource ID into a resource information entry included in a header of the resource database, which corresponds to the record.
In order to achieve the second object, the present invention provides a method of retrieving data with a keyword from a Palm OS based hand-held device where the data has been stored by using the method of the present invention, characterized by the steps of:
converting the keyword into a long integer;
dividing the long integer into two parts, respectively, as a resource type and a resource ID, and retrieving a resource which uniquely corresponds to the resource type and the resource ID from a respective resource database by using Palm OS; and
obtaining all data in the resource, as retrieved data.
In order to achieve the third object, the present invention provides an apparatus for storing data into a Palm OS based handheld device, the data including at least one record, each one of the records containing a keyword used for identifying the record, the apparatus comprising:
means for converting the keyword contained in the record from a string into a long integer;
means for dividing the long integer into two parts, respectively, as a resource type and a resource ID;
means for forming a new resource by combining the resource type, the resource ID and contents of the record; and
means for adding the new resource into a resource database in the handheld device in order to update the database.
In order to achieve the fourth object, the present invention provides an apparatus for retrieving data with a keyword from a Palm OS based handheld device where the data has been stored by using the apparatus of the present invention, characterized by comprising:
means for converting the keyword from a string into a long integer;
means for dividing the long integer into two parts, respectively, as a resource type and a resource ID; and
means for retrieving a resource which uniquely corresponds to the resource type and the resource ID from a respective resource database with the Palm OS, and obtaining all data in the resource.
In this invention, when the data containing a keyword is stored, the keyword is converted into a long integer to be used as the resource type and resource ID. Then the functions of the OS itself can be used directly. The space to store the keyword and index can be saved. Furthermore, integer operations are much faster than string operations. Compared with the normal searching method by keywords, the searching method in this invention is much faster.
For more general use, string data can be converted into an integer before it is stored to save storage space. If n is the number of the kinds of characters in the string data to be stored, this invention can save the space of (1xe2x88x92log(n)/log(256))xc3x97100%. Another advantage is the data being stored has some kind of encryption, which is not easy to read in the normal way.